﻿// Decompiled with JetBrains decompiler
// Type: 我的小工具.frmDbNames
// Assembly: 开发辅助工具, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: F78E5980-5E94-4E46-ABDF-DC8C6CBF52AA
// Assembly location: K:\Tools\工具\开发辅助工具庆六一版\开发辅助工具2015-06-01\开发辅助工具.exe

using PetaPoco;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace 我的小工具
{
  public class frmDbNames : Form
  {
    private sqlserverDB db = new sqlserverDB();
    public string KeyWords = "";
    private IContainer components = (IContainer) null;
    private Panel panel1;
    private Button button1;
    private Panel panel2;
    private Label label1;
    private TextBox textBox1;
    private DataGridView dataGridView1;
    private DataGridViewTextBoxColumn DataSOURCE;
    private DataGridViewTextBoxColumn DBName;
    private DataGridViewTextBoxColumn UserID;
    private DataGridViewTextBoxColumn PassWord;
    private DataGridViewTextBoxColumn dbid;
    private DataGridViewTextBoxColumn filename;

    public frmDbNames()
    {
      this.InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      this.FindNbName(this.textBox1.Text);
    }

    private void frmDbNames_Load(object sender, EventArgs e)
    {
      this.textBox1.Text = this.KeyWords;
      this.FindNbName(this.textBox1.Text);
    }

    private void FindNbName(string strKeyWords)
    {
      Sql sql = new Sql("SELECT DataSOURCE,name,UserID,PASSWORD,dbid,filename FROM dp_DataBase Where ", new object[0]);
      if (strKeyWords != "")
        sql.Append("name like '%" + strKeyWords.Replace("'", "''") + "%'", new object[0]);
      else
        sql.Append("1=2", new object[0]);
      sql.OrderBy((object) "name");
      this.dataGridView1.DataSource = (object) this.db.Query<dp_DataBase>(sql).ToList<dp_DataBase>();
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
      if (this.textBox1.Text.Length < 2)
        return;
      this.FindNbName(this.textBox1.Text);
    }

    protected override void Dispose(bool disposing)
    {
      if (disposing && this.components != null)
        this.components.Dispose();
      base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
      this.panel1 = new Panel();
      this.label1 = new Label();
      this.textBox1 = new TextBox();
      this.button1 = new Button();
      this.panel2 = new Panel();
      this.dataGridView1 = new DataGridView();
      this.DataSOURCE = new DataGridViewTextBoxColumn();
      this.DBName = new DataGridViewTextBoxColumn();
      this.UserID = new DataGridViewTextBoxColumn();
      this.PassWord = new DataGridViewTextBoxColumn();
      this.dbid = new DataGridViewTextBoxColumn();
      this.filename = new DataGridViewTextBoxColumn();
      this.panel1.SuspendLayout();
      this.panel2.SuspendLayout();
      ((ISupportInitialize) this.dataGridView1).BeginInit();
      this.SuspendLayout();
      this.panel1.Controls.Add((Control) this.label1);
      this.panel1.Controls.Add((Control) this.textBox1);
      this.panel1.Controls.Add((Control) this.button1);
      this.panel1.Dock = DockStyle.Top;
      this.panel1.Location = new Point(0, 0);
      this.panel1.Name = "panel1";
      this.panel1.Size = new Size(535, 40);
      this.panel1.TabIndex = 0;
      this.label1.AutoSize = true;
      this.label1.Location = new Point(13, 13);
      this.label1.Name = "label1";
      this.label1.Size = new Size(47, 12);
      this.label1.TabIndex = 2;
      this.label1.Text = "DBNAME:";
      this.textBox1.Location = new Point(60, 9);
      this.textBox1.Name = "textBox1";
      this.textBox1.Size = new Size(382, 21);
      this.textBox1.TabIndex = 1;
      this.textBox1.TextChanged += new EventHandler(this.textBox1_TextChanged);
      this.button1.Location = new Point(448, 7);
      this.button1.Name = "button1";
      this.button1.Size = new Size(75, 23);
      this.button1.TabIndex = 0;
      this.button1.Text = "查询";
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Click += new EventHandler(this.button1_Click);
      this.panel2.Controls.Add((Control) this.dataGridView1);
      this.panel2.Dock = DockStyle.Fill;
      this.panel2.Location = new Point(0, 40);
      this.panel2.Name = "panel2";
      this.panel2.Size = new Size(535, 223);
      this.panel2.TabIndex = 1;
      this.dataGridView1.AllowUserToAddRows = false;
      this.dataGridView1.AllowUserToDeleteRows = false;
      this.dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
      this.dataGridView1.Columns.AddRange((DataGridViewColumn) this.DataSOURCE, (DataGridViewColumn) this.DBName, (DataGridViewColumn) this.UserID, (DataGridViewColumn) this.PassWord, (DataGridViewColumn) this.dbid, (DataGridViewColumn) this.filename);
      this.dataGridView1.Dock = DockStyle.Fill;
      this.dataGridView1.Location = new Point(0, 0);
      this.dataGridView1.Name = "dataGridView1";
      this.dataGridView1.RowHeadersVisible = false;
      this.dataGridView1.RowTemplate.Height = 23;
      this.dataGridView1.Size = new Size(535, 223);
      this.dataGridView1.TabIndex = 0;
      this.DataSOURCE.DataPropertyName = "DataSOURCE";
      this.DataSOURCE.HeaderText = "服务器名称";
      this.DataSOURCE.Name = "DataSOURCE";
      this.DataSOURCE.Width = 150;
      this.DBName.DataPropertyName = "name";
      this.DBName.HeaderText = "数据库名称";
      this.DBName.Name = "DBName";
      this.DBName.Width = 150;
      this.UserID.DataPropertyName = "UserID";
      this.UserID.HeaderText = "用户名";
      this.UserID.Name = "UserID";
      this.UserID.Width = 70;
      this.PassWord.DataPropertyName = "PASSWORD";
      this.PassWord.HeaderText = "密码";
      this.PassWord.Name = "PassWord";
      this.PassWord.Width = 60;
      this.dbid.DataPropertyName = "dbid";
      this.dbid.HeaderText = "dbid";
      this.dbid.Name = "dbid";
      this.dbid.Width = 60;
      this.filename.DataPropertyName = "filename";
      this.filename.HeaderText = "文件路径";
      this.filename.Name = "filename";
      this.filename.Width = 160;
      this.AutoScaleDimensions = new SizeF(6f, 12f);
      this.AutoScaleMode = AutoScaleMode.Font;
      this.ClientSize = new Size(535, 263);
      this.Controls.Add((Control) this.panel2);
      this.Controls.Add((Control) this.panel1);
      this.Name = "frmDbNames";
      this.ShowIcon = false;
      this.StartPosition = FormStartPosition.CenterParent;
      this.Text = "DbName查询";
      this.Load += new EventHandler(this.frmDbNames_Load);
      this.panel1.ResumeLayout(false);
      this.panel1.PerformLayout();
      this.panel2.ResumeLayout(false);
      ((ISupportInitialize) this.dataGridView1).EndInit();
      this.ResumeLayout(false);
    }
  }
}
